<template>
  <el-dialog title="题目审核" width="600px " :visible="visible" @close="handleClose" >
      <el-form size="small"  label-width="80px" ref="formRef">
        <el-form-item>
          <el-radio :label="2" v-model="checkDataList.chkState" >通过</el-radio>
          <el-radio :label="3" v-model="checkDataList.chkState">拒绝</el-radio>
        </el-form-item>
        <el-form-item>
          <el-input type="textarea" v-model="checkDataList.chkRemarks" placeholder="请输入审核意见"></el-input>
        </el-form-item>
      </el-form>
      <!-- footer插槽 -->
    <template #footer >
      <el-button @click="handleClose">取消</el-button>
      <el-button type="primary" @click="handleSubmit">确定</el-button>
    </template>
    </el-dialog>
</template>

<script>
import { choiceCheck } from '@/api/hmmm/questions'
export default {
  name: 'QuestionsCheck',
  props: {
    visible: {
      type: Boolean,
      default: false
    },
    checkData: {
      type: Object,
      required: true
    }
  },
  data () {
    return {
      checkDataList: {
        id: '',
        chkState: '',
        chkRemarks: ''
      }
    }
  },
  methods: {
    handleClose () {
      this.$emit('update:visible', false)
      this.$refs.formRef.resetFields()
      this.checkDataList = {
        id: '',
        chkState: '',
        chkRemarks: ''
      }
    },
    async handleSubmit () {
      console.log()
      if (!this.checkDataList.chkRemarks) return this.$message.warning('请输入审核意见')
      this.checkDataList.id = this.checkData.id
      await choiceCheck(this.checkDataList)
      this.$message.success('操作成功')
      this.$emit('update:visible', false)
      this.$emit('updateList')
    }

  }
}
</script>

<style scoped lang='less'></style>
